{include file="public/header" /}



<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.adv_index_manage}</h3>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>

    <form method="get" name="formSearch" id="formSearch">
        <div class="sc-search-form">
            <dl>
                <dt>{$Think.lang.adv_ap_id}</dt>
                <dd>
                    <select name="ap_id">
                        <option value="">{$Think.lang.sc_please_choose}...</option>
                        {foreach name="ap_list" item="ap_v"}
                        <option value="{$ap_v.ap_id}" {if condition="$Request.param.ap_id eq $ap_v.ap_id"}selected{/if}>{$ap_v.ap_name}[{$ap_v.ap_width}X{$ap_v.ap_height}]</option>
                        {/foreach}
                    </select>
                </dd>
            </dl>
            <div class="btn-group">
                <input type="submit" class="btn" value="{$Think.lang.sc_search}">
                {if $filtered}
                <a href="{:url('Appadv/adv')}" class="btn btn-default" title="{$Think.lang.sc_cancel}">{$Think.lang.sc_cancel}</a>
                {/if}
            </div>
        </div>
    </form>

    <div class="fixed-empty"></div>
    <form method="post">
        <table class="sc-default-table">
            <thead>
                <tr class="thead">
                    <th></th>
                    <th>{$Think.lang.adv_name}</th>
                    <th>{$Think.lang.adv_ap_id}</th>
                    <th>{$Think.lang.adv_sort}</th>
                    <th>{$Think.lang.adv_enabled}</th>
                    <th class="align-center">{$Think.lang.start_time}</th>
                    <th class="align-center">{$Think.lang.end_time}</th>
                    <th class="align-center">{$Think.lang.sc_handle}</th>
                </tr>
            </thead>
            <tbody>
                {notempty name="adv_info"}
                {foreach name="adv_info" item="v"}
                <tr class="hover">
                    <td class="w24"><input type="checkbox" class="checkitem" name="del_id[]" value="{$v.adv_id}" /></td>
                    <td class="name"><span class="editable"  sc_type="inline_edit" ajax_branch='adv_branch' fieldname="adv_title" fieldid="{$v.adv_id}" required="1"  title="{$Think.lang.sc_editable}">{$v.adv_title}</span></td>
                    <td>
                        {foreach name="ap_list" item="ap_v"}
                        {if $ap_v.ap_id === $v.ap_id }
                        <span title="{$ap_v.ap_name}">{$ap_v.ap_name}</span>
                        {/if}
                        {/foreach}
                    </td>
                    <td class="align-center sort"><span title="{$Think.lang.sc_editable}" ajax_branch="adv_branch" datatype="number" fieldid="{$v.adv_id}" fieldname="adv_sort" sc_type="inline_edit" class="editable">{$v.adv_sort}</span></td>
                    <td class="align-center yes-onoff">
                        {if $v.adv_enabled eq '0'}
                        <a href="JavaScript:void(0);" class="disabled" ajax_branch="adv_branch" sc_type="inline_edit" fieldname="adv_enabled" fieldid="{$v.adv_id}" fieldvalue="0" title="{$Think.lang.sc_editable}"><img src="{$Think.ADMIN_SITE_ROOT}/images/treetable/transparent.gif"></a>
                        {else /}
                        <a href="JavaScript:void(0);" class="enabled" ajax_branch="adv_branch" sc_type="inline_edit" fieldname="adv_enabled" fieldid="{$v.adv_id}" fieldvalue="1" title="{$Think.lang.sc_editable}"><img src="{$Think.ADMIN_SITE_ROOT}/images/treetable/transparent.gif"></a>
                        {/if}
                    </td>
                    <td class="align-center nowrap">{$v.adv_startdate|date='Y-m-d',###}</td>
                    <td class="align-center nowrap">{$v.adv_enddate|date='Y-m-d',###}</td>
                    <td class="w72 align-center">
                        <a href="javascript:scLayerOpen('{:url('Appadv/adv_edit',['adv_id'=>$v.adv_id])}','{$Think.lang.sc_edit}-{$v.adv_title}')"  class="dsui-btn-edit"><i class="fa"></i>{$Think.lang.sc_edit}</a>
                        <a href="javascript:scLayerConfirm('{:url('Appadv/adv_del',['adv_id'=>$v.adv_id])}','{$Think.lang.sc_ensure_install}')" class="dsui-btn-del"><i class="fa"></i>{$Think.lang.sc_del}</a>
                    </td>
                </tr>
                {/foreach}
                {else /}
                <tr class="no_data">
                    <td colspan="15">{$ap_name}{$Think.lang.sc_no_record}</td>
                </tr>
                {/notempty}
            </tbody>
        </table>
        {$show_page}
    </form>
</div>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>